Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix #9335, prevent duplicate txis in fluff queue. #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0xFFFC0000
Copy link
Owner

No description provided.

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/fluff_queue_duplicate branch from b2333dd to a899386 Compare June 3, 2024 20:14
Copy link

@Boog900 Boog900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

This would fix the issue but it includes another tx parse when adding txs to the fluff queue, which isn't ideal IMO.

Another way, because the txs are already sorted before being sent, is to just check sequential txs are not equal, if they are only add one of them to the message.

This does mean we still get duplicates in the queue but I don't think this isn't too big of a problem.

Comment on lines 1055 to 1067
{
cryptonote::transaction transaction;
if(cryptonote::parse_and_validate_tx_from_blob(tx, transaction))
{
if(fluff_txs_hash.find(transaction.hash) != fluff_txs_hash.end())
{
break;
}
fluff_txs_hash.emplace(transaction.hash);
}
fluff_txs.push_back(std::move(tx));
break;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed, right?

We already check for duplicates in the whole message at the top of this function.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha. Saw the code here: https://github.com/0xFFFC0000/monero/blob/a899386881a79fecae1fbaf0fc463f33367599c6/src/cryptonote_protocol/cryptonote_protocol_handler.inl#L997

We don’t need the code here in cryptonote_protocol_handler.inl .

Thanks for mentioning it.

@0xFFFC0000
Copy link
Owner Author

@Boog900

There is a minor issue. I was thinking about doing it without parse tx.

But there was a malleability bug with varints where you could encode the value 0 as "\00", "\8000", "\808000", etc. So there may be two different blobs which have the same TXID.

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/fluff_queue_duplicate branch 2 times, most recently from efb82f0 to 79b7a45 Compare June 5, 2024 10:26
@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/fluff_queue_duplicate branch from 79b7a45 to 86264f3 Compare June 5, 2024 10:27
Copy link

sonarcloud bot commented Jun 5, 2024

Please retry analysis of this Pull-Request directly on SonarCloud

0xFFFC0000 added a commit that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants